<template>
  <div>
    <el-row>
     <el-card class="shuxing-left">
     <el-tree :data="list"  :props="defaultProps" node-key="id"
      @node-click="handleNodeClick" icon-class="el-icon-caret-right" :highlight-current="true"></el-tree>
   </el-card>
  </el-row>
  </div>
</template>

<script>
import { InstitutionalDetails, treeShapedApi } from '@/api/institution'
export default {
  name: 'wuliulTree',
  data () {
    return {
      list: [],
      defaultProps: {
        children: 'children',
        label: 'name'
      },
      form: []
    }
  },
  created () {
    this.getshuxungList()
  },
  methods: {
    async  handleNodeClick (data) {
      console.log(data.id)
      const res = await InstitutionalDetails(data.id)
      // console.log(res)
      this.form = res.data
      console.log(this.form)
    },
    // 树形
    async getshuxungList () {
      const res = await treeShapedApi()
      // console.log(res)
      this.list = JSON.parse(res.data)
      // console.log(this.list)
    }

  }
}
</script>

<style>

</style>
